package com.xiguaji.tiktok.v1.tiktok.permission.repository;

import com.xiguaji.tiktok.v1.tiktok.permission.model.PermissionLimit;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;
@Repository
public interface PermissionLimitRepository extends CrudRepository<PermissionLimit,Long> {

    Optional<PermissionLimit> findByPermissionIdAndProductIdAndAllow(long permissionId,long productId,String allow);

    Optional<PermissionLimit> findByPermissionIdAndProductId(long permissionId,long productId);

    Optional<PermissionLimit> findByPermissionIdAndProductIdAndLimitCountGreaterThanEqual(long permissionId,long productId,int limitCount);

    PermissionLimit findTop1ByPermissionIdAndProductId(long permissionId,long productId);
}
